亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

最土團(tuán)購(gòu)商品按價(jià)格排序?qū)崿F(xiàn)方法分享

  發(fā)布時(shí)間:2012-01-09 15:54:36   作者:佚名   我要評(píng)論
因?yàn)楣疽獙?shí)現(xiàn)商品按價(jià)格排序,網(wǎng)上都是收費(fèi)的,為了省錢也為了體驗(yàn)下修改的樂趣,通過前臺(tái)帶推斷出后臺(tái)代碼的實(shí)現(xiàn)方法。

要想實(shí)現(xiàn)按價(jià)格排序需要前臺(tái)有鏈接,后臺(tái)然后實(shí)現(xiàn)相應(yīng)的功能即可。

前臺(tái)代碼:\include\template\team_multi.html
這個(gè)模板文件,因?yàn)槲覀兪情_啟了首頁顯示多項(xiàng)團(tuán)購(gòu)顯示,所以用點(diǎn)的這個(gè)team_multi.html這個(gè)模板

復(fù)制代碼
代碼如下:

<div class="filter-by-group-title">按價(jià)格:</div>
<div class="filter-by-group-id">
<ul class="cates">
<li
<!--{if $selector_p == ''}-->
class="current"
<!--{/if}-->
><a href="?gid={$_GET['gid']}&areaid={$_GET['areaid']}">全部</a>
</li>
<li
<!--{if $selector_p == 'p1'}-->
class="current"
<!--{/if}-->
><a href="?gid={$_GET['gid']}&areaid={$_GET['areaid']}&p=p1">10元以下</a>
</li>
<li
<!--{if $selector_p == 'p2'}-->
class="current"
<!--{/if}-->
><a href="?gid={$_GET['gid']}&areaid={$_GET['areaid']}&p=p2">10-50元</a>
</li>
<li
<!--{if $selector_p == 'p3'}-->
class="current"
<!--{/if}-->
><a href="?gid={$_GET['gid']}&areaid={$_GET['areaid']}&p=p3">50-100元</a>
</li>
<li
<!--{if $selector_p == 'p4'}-->
class="current"
<!--{/if}-->
><a href="?gid={$_GET['gid']}&areaid={$_GET['areaid']}&p=p4">100-200元</a>
</li>
<li
<!--{if $selector_p == 'p5'}-->
class="current"
<!--{/if}-->
><a href="?gid={$_GET['gid']}&areaid={$_GET['areaid']}&p=p5">200元以上</a>
</li>
</ul>
</div>
</div>


后臺(tái)代碼:\include\function\common.php
index_get_team 函數(shù) 修改后的代碼

復(fù)制代碼
代碼如下:

function index_get_team($city_id,$group_id=0,$p="") {
global $INI;
$multi = option_yes('indexmulti');
$city_id = abs(intval($city_id));
/* 是否首頁多團(tuán),不是則返回當(dāng)前城市 */
if (!$multi) return current_team($city_id);
$now = time();
$size = abs(intval($INI['system']['indexteam']));
/* 側(cè)欄團(tuán)購(gòu)數(shù)小于1,則返回當(dāng)前城市數(shù)據(jù) */
if ($size<=1) return current_team($city_id);
switch ($p)
{
case "p1":
$pp1="team_price < '10'";
$pp2="";
break;
case "p2":
$pp1="team_price > '10'";
$pp2="team_price < '50'";
break;
case "p3":
$pp1="team_price > '50'";
$pp2="team_price < '100'";
break;
case "p4":
$pp1="team_price > '100'";
$pp2="team_price < '200'";
break;
case "p5":
$pp1="team_price > '200'";
$pp2="";
break;
default:
$pp1="";
$pp2="";
}
$oc = array(
'team_type' => 'normal',
"begin_time < '{$now}'",
"end_time > '{$now}'",
);
if(!empty($pp1)){
array_push($oc,$pp1);
}
if(!empty($pp2)){
array_push($oc,$pp2);
}
if($group_id) $oc['group_id']=$group_id;
/* 數(shù)據(jù)庫(kù)匹配多個(gè)城市訂單,前者按照多城市搜索,后者兼容舊字段city_id搜索 */
$oc[] = "(city_ids like '%@{$city_id}@%' or city_ids like '%@0@%') or (city_ids = '' and city_id in(0,{$city_id}))";
$teams = DB::LimitQuery('team', array(
'condition' => $oc,
'order' => 'ORDER BY `sort_order` DESC, `id` DESC',
'size' => $size,
));
if(count($teams) == 1) return array_pop($teams);
return $teams;
}

需要在index.php頁面中增加一個(gè)
$selector_p=$p=addslashes($_GET['p']);方面當(dāng)前價(jià)格的高亮。
結(jié)合以上幾點(diǎn),即可實(shí)現(xiàn)最土團(tuán)購(gòu)ZuituGo_CV2.0_20111231 商業(yè)版的價(jià)格排序功能。

相關(guān)文章

最新評(píng)論